<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <p v-for="(item,index) of orders" :key="index">
            {{item.name}} == {{item.price}}
        </p>
        <h1>{{total}}</h1>
    </div>
    <script src="../../vue.js"></script>
    <script>
       let app =  new Vue({
            el : '#app',
            data : {
                orders : [
                    {name : '书籍',price : 13},
                    {name : '视频',price : 14},
                    {name : '视频',price : 15}
                ]
            },
            computed : {
                total(){
                    let totalPrice = 0;
                    for(let order of this.orders){
                        totalPrice += order.price
                    }
                    return totalPrice
                }
            }
        })
    </script>
</body>
</html>